﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LINQ0_1000随机数操作
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int i;
            double sum = 0;
            double[] arr = new double[100];
            Random random = new Random();
            for (i = 0; i < arr.Length; i++)
            {

                arr[i] = random.Next(1001);
            }
            //double[] arr = { 1, 312412, 242523442345, 2134, 423, 5423, 26 };
            double[] new_arr = arr.OrderByDescending(x => x).ToArray();
            for (i = 0; i < arr.Length; i++)
            {
                if (i % 10 == 0 && i != 0)
                {
                    Console.WriteLine();
                }
                Console.Write("{0,-5}", new_arr[i]);
                sum += new_arr[i];
            }
            Console.WriteLine();
            Console.WriteLine("和：{0}", sum);
            Console.WriteLine("均值：{0}", sum / 100);
            Console.Read();
        }
    }
}
